/**
 * 
 */
package com.scpii.universal.hibernate.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.scpii.universal.constant.GenericConstants;
import com.scpii.universal.hibernate.dao.SortColumnsDao;
import com.scpii.universal.hibernate.entity.SortColumnsTab;


/**
 * genericWeb
 * @author acer
 * 2012-7-5下午04:35:11
 */
@Repository
public class SortColumnsDaoImpl extends BaseDaoImpl<SortColumnsTab, Integer> implements SortColumnsDao{

	@Override
	public List<SortColumnsTab> getSortColumnsByTableName(String tableName) {
		return getSortColumnsByTableName(tableName, 0);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<SortColumnsTab> getSortColumnsByTableName(String tableName,
			int intAppId) {
		String hql = "from SortColumnsTab s where s.intDeleteSign=? and s.varSortTableName=?"
				+ " and s.intAppId=?";
		return getHibernateTemplate().getSessionFactory().getCurrentSession()
				.createQuery(hql)
				.setParameter(0, GenericConstants.DELETE_SIGN_EXIST)
				.setParameter(1, tableName).setParameter(2, intAppId).list();
	}

}
